import re
from datetime import datetime


class Utils:
    def validate_bvid(self, bvid,code=200):
        """增强的BV号验证"""
        message=bvid
        if not bvid:
            message = "请输入BV号"
            code=400
        elif len(bvid) != 12 or not bvid.startswith("BV"):
            message = "无效的BV号格式\n(应为BV开头的12位字符)"
            code=400
        elif not re.search(r'^BV[0-9A-Za-z]{10}$', bvid):
            message = "无效的BV号格式\n(应为BV开头的12位字符)"
            code=400
        return {'code': code, 'message': message}
    def tramsform_timestamp(self, timestamp):
        return datetime.strftime(datetime.fromtimestamp(timestamp), '%Y-%m-%d')

if __name__ == '__main__':
    utils = Utils()
    timestamp= 1678297600
    print(utils.tramsform_timestamp(timestamp))